home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
COMAL
/
A-COMAL Series
/
(k)aac.d64
/
comal-sieve.l
< prev
next >
Wrap
Text File
|
2007-02-28
|
676b
|
28 lines
0010 PRINT CHR$(147),"SIEVE TEST"
0020 SI#:=1000; ML#:=10
0030 PRINT "ARRAY SIZE:";SI#
0040 PRINT "NUMBER ITERATIONS:";ML#
0050 POKE 162,0 // SET
0060 POKE 161,0 // JIFFY
0070 POKE 160,0 // TIME
0080 DIM FLAGS#(0:SI#)
0090 FOR ITER#:=1 TO ML# DO
0100 FOR I#:=0 TO SI# DO FLAGS#(I#):=TRUE
0110 PRINT "LOOP ",ITER#
0120 COUNT#:=0
0130 FOR I#:=0 TO SI# DO
0140 IF FLAGS#(I#) THEN
0150 PRIME#:=I#+I#+3
0160 K#:=I#+PRIME#
0170 WHILE K#<=SI# DO
0180 FLAGS#(K#):=FALSE
0190 K#:+PRIME#
0200 ENDWHILE
0210 COUNT#:+1
0220 ENDIF
0230 ENDFOR I#
0240 ENDFOR ITER#
0250 PRINT "COUNT=";COUNT#
0260 T3:=PEEK(162); T2:=PEEK(161); T1:=PEEK(160)
0270 PRINT (T1*256*256+T2*256+T3)/60;"SECONDS"